package base
{
    import com.greensock.TweenMax;
    
    public class BaseSummon extends BaseObject
    {
        public function BaseSummon()
        {
            super();
        }
        
        protected var _owner:BaseObject;
        
        public var destroyInCount:int = 0;
        
        public function setOwner(o:BaseObject):void
        {
            _owner = o;
        }
        
        public function getOwner():BaseObject
        {
            return _owner;
        }
        
        public function setDestroyInCount(value:int):void
        {
            destroyInCount = value;
        }
        
        override public function renderAnimate():void
        {
            super.renderAnimate();
            if(destroyInCount-- <= 0)
            {
                destroy();
            }
        }
        
        override public function destroy():void
        {
            _owner = null;
            for each (var bullet:BaseBullet in magicBulletArray)
            {
                bullet.setDisable();
                TweenMax.killChildTweensOf(bullet);
                bullet.destroy();
            }
            magicBulletArray = [];
            removeFromParent();
            isReadyToDestroy = true;
        }
    }
}
